
#ifndef __max7500_c__
#define __max7500_c__

#include <zneo.h>

#include "i2c.h"
#include "max7500.h"

float max7500_read_temp_c( void ) { 
	unsigned short data = 0x00;

	i2c_write_byte( MAX7500_ADDR_WRITE, MAX7500_TEMP_REG );

	data = i2c_read_short( MAX7500_ADDR_READ );

	return ((float)(data&0x7F80))/0x0100;
}

float max7500_read_temp_f( void ) {
	float tc = max7500_read_temp_c();
	return 32+(tc*9/5);
}

#endif